/*
package com.zijin.controller;

import com.zijin.entity.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.regex.Pattern;

*/
/**
 * Copyright: Copyright (c) 2020 TD
 *
 * <p> Description: 表单控制器
 *
 * @author lius
 * @version 1.0.0
 * @date 2020/12/09 2020/12/9:4:44 下午
 *//*

@RequestMapping("form")
@RestController
public class FormController {

    @Autowired
    private TokenUtils tokenUtils;
    @Autowired
    private UserInfoService userInfoService;
    @Autowired
    private FormInfoService formInfoService;


    */
/**
     * 表单提交
     *//*

    @PostMapping("submitUserInfo")
    public Result submitForm(@RequestParam(value = "token", required = true) String token, FormInfo formInfo, HttpServletRequest request) throws IOException {
        if (StringUtils.isEmpty(token) || "null".equals(token)) {
            return Result.error("当前登录用户有误，请重新登录!", null);
        }
        UserInfo one = userInfoService.getOne(new LambdaQueryWrapper<UserInfo>().eq(UserInfo::getToken, token));
        if (one == null) {
            return Result.error("当前登录用户有误，请重新登录!", null);
        }
        boolean b = tokenUtils.validateToken(token, one);
        if (!b) {
            return Result.error("身份校验失败，请重新登录后重新填写！", null);
        }
        Pattern number = Pattern.compile("^-?\\d+(\\.\\d+)?$");
        Pattern phone = Pattern.compile("^[1][3,4,5,6,7,8,9][0-9]{9}$"); // 验证手机号;
        if (formInfo.getInvestorStatus().equals("其他（非校内在编或曾经在编人员）")) {
            if (StringUtils.isEmpty(formInfo.getIntroducerName())) {
                return Result.error("介绍人姓名不能为空", null);
            }
            if (StringUtils.isEmpty(formInfo.getIntroducerPhone())) {
                return Result.error("介绍人联系方式不能为空", null);
            } else {
                if (!phone.matcher(formInfo.getIntroducerPhone()).matches()) return Result.error("介绍人联系方式格式不正确", null);
            }
            if (StringUtils.isEmpty(formInfo.getIntroducerUnit())) {
                return Result.error("介绍人工作单位不能为空", null);
            }
        }
        if (StringUtils.isEmpty(formInfo.getInvestCounts())) {
            return Result.error("累计投资次数不能为空", null);
        } else {
            if (!number.matcher(formInfo.getInvestCounts()).matches()) return Result.error("累计投资次数必须为数字", null);
        }

        if (StringUtils.isEmpty(formInfo.getInvestStartDate())) {
            return Result.error("投资开始时间不能为空", null);
        }
        if (StringUtils.isEmpty(formInfo.getInvestEndDate())) {
            return Result.error("投资结束时间不能为空", null);
        }
        if (TimeUtils.str2LocalDate(formInfo.getInvestStartDate()).isAfter(TimeUtils.str2LocalDate(formInfo.getInvestEndDate()))) {
            return Result.error("投资开始时间必须小于投资结束时间", null);
        }
        if (StringUtils.isEmpty(formInfo.getSignedName())) {
            return Result.error("合同签订人姓名不能为空", null);
        }
        if (StringUtils.isEmpty(formInfo.getInvestTotalAmount())) {
            return Result.error("投资总金额不能为空", null);
        }
        if (StringUtils.isEmpty(formInfo.getCompanyPaidAmount())) {
            return Result.error("公司累计返还金额不能为空", null);
        }

        if (StringUtils.isEmpty(formInfo.getPaytype())) {
            return Result.error("请填写支付方式！", null);
        }

        if (formInfo.getPaytype().contains("现金")) {
            if (StringUtils.isEmpty(formInfo.getMoneyCompanyRecName())) {
                return Result.error("请填写公司收款人姓名！", null);
            }
            if (StringUtils.isEmpty(formInfo.getMoneyAmount())) {
                return Result.error("请填写金额！", null);
            }
        }

        if (formInfo.getPaytype().contains("微信或支付宝")) {
            if (StringUtils.isEmpty(formInfo.getOnlinePaidAccount())) {
                return Result.error("请填写投资本金支付微信或支付宝账号！", null);
            }
            if (StringUtils.isEmpty(formInfo.getOnlineRecAccount())) {
                return Result.error("请填写投资返利支付微信或支付宝账号！", null);
            }
        }

        if (b) {
            boolean save = formInfoService.saveInfo(request, one, formInfo);
            return save ? Result.success("登记成功，等待审核！", null) : Result.error("登记失败，请稍后重试！", null);
        }
        return Result.error("身份校验失败！", null);
    }

}
*/
